
const article = {
    namespaced:true,
    state:{
        haveLikeList: JSON.parse(localStorage.getItem('HAVELIKELIST') as any) || [] // 已经点过赞的文章数据
    },
    mutations:{
        // 添加已经点赞的文章列表
        addHaveLikeList(state:any,articleId:number){
            state.haveLikeList.push(articleId)
            // @ts-ignore
            this.commit('article/SAVE_HAVE_LIKE_LIST',articleId)
        },
        // 持久化存储当前的点赞列表
        SAVE_HAVE_LIKE_LIST(state:any){
            localStorage.setItem('HAVELIKELIST',JSON.stringify(state.haveLikeList))
        },
    }
}

export default article